using SCSFContrib.CompositeUI.WinForms;
using OrdersManager.Infrastructure.Interface;
using OrdersManager.Module.Constants;
using OrdersManager.Module.Services;
using OrdersManager.Module.Views;

namespace OrdersManager.Module.Workitems
{
    public class OrdersListWorkItemController : WorkItemController
    {
        private OrderStatus _orderStateMode;

        public OrderStatus OrderStateMode
        {
            get
            {
            	return _orderStateMode;
            }
            set
            {
            	_orderStateMode = value;
            }
        }

        public override void Run()
        {
            AddServices();
            AddViews();
        }

        private void AddServices()
        {
            //Add items to workitem
            WorkItem.Items.Add(_orderStateMode, "OrderStateMode");

            WorkItem.Services.AddNew<OrderPollingService, IOrderPollingService>();
        }

        private void AddViews()
        {
            //Create view and add it to workspace
            OrderListView view = WorkItem.SmartParts.AddNew<OrderListView>();
            WorkItem.Workspaces[WorkspaceNames.OutlookBarWorkspace].Show(view);
        }
    }
}
